<?php
class showMod extends commonMod
{
	public function __construct()
	{
		parent::__construct();

	}
	public function newlist(){
		$id=intval($_GET[0]);//文章id
		if(empty($id))
		{
			$this->error('参数传递有误');
		}
		$condition['cid']=$id;
		$list=$this->model->table('content')->where($condition)->limit($limit)->order('id desc')->select();
		if($list)
		{
			foreach($list as &$val)
			{
				$val['addtime']	= date('Y-m-d',$val['addtime']);
				$val['url']			= __APP__.'/show/show-'.$val['id'].'.html';
			}
			return $list;
		}
		$this->assign('list',$list);
		$this->display('newlist');
	}
	
	//显示文章内容
	public function show()
	{
		$id=intval($_GET[0]);//文章id
		if(empty($id))
		{
			$this->error('参数传递有误');
		}
		$condition['id']=$id;
    	$info=$this->model->table('content')->where($condition)->find();
		$info['content']=html_out($info['content']);
		$info['addtime']= date('Y-m-d H:i:s',$info['addtime']);
		$this->assign('info',$info);
		$this->display('show');
	}
}
?>